import { defineConfig } from 'vite' // 动态配置函数
// import { createVuePlugin } from 'vite-plugin-vue2'
import vue2 from '@vitejs/plugin-vue2'
import { resolve } from 'path'

export default () =>
	defineConfig({
		plugins: [
			vue2()
		],
		server: {
			open: true, //自动打开浏览器
			port: 8080 //端口号
		},
		resolve: {
			// 别名
			alias: [
				{
					find: '@',
					replacement: '/src'
				}
			],
			extensions: ['.vue', '.js'],
		},
		css: {
			preprocessorOptions: {
				scss: {
					// additionalData: `@import "@/styles/variables.scss";`
					implementation: require('sass-embedded'),
					additionalData: `@use "@/styles/variables.scss" as *;`
				}
			}
		}
	})

